#!/bin/bash

#TODO: path + pico.def cmd options

if [ -z $1 ];then
	echo "Specify output path as option"
	exit 1
fi

if [ -d $1 ]; then
	echo "generating api in directory: " $1
	echo "TODO: make path an env variable and cmd line option"
	export PATH=$PATH:/opt/meta-env/bin
	sdf2-to-java -I -i ../src/main/resources/pico.def --name PicoLanguage --package nl.uva.science.pico --version 1.0 -o $1
	
	echo "Deleting class files"
	find $1 -name *.class -exec rm {} \;
	
	echo "TODO: move files"
	echo "TODO: svn commit"
	echo "TDOO: mvn release"
else
	echo "No such directory: " $1
	exit 1
fi 